import { request } from "@/utils/service"
import {
  GetMessageParams,
  GetMessageRes,
  PushData,
  GetPushingRes,
  savePushingRes,
  GetMonitorParams,
  GetMonitorRes
} from "./type"

/** 获取消息列表 */
export function getMessagePage(data: GetMessageParams) {
  return request<GetMessageRes>({
    url: "/confined/monitor/getMessagePage",
    method: "post",
    data
  })
}
/** 查询推送设置 */
export function getPushSetting() {
  return request<GetPushingRes>({
    url: "/confined/monitor/getPushSetting",
    method: "get"
  })
}
/** 保存推送设置 */
export function savePushSetting(data: PushData) {
  return request<savePushingRes>({
    url: "/confined/monitor/savePushSetting",
    method: "post",
    data
  })
}
/** 查询监控列表 */
export function getMyMonitorCompanyList(params: GetMonitorParams) {
  return request<GetMonitorRes>({
    url: "/confined/monitor/getMyMonitorCompanyList",
    method: "get",
    params
  })
}
/** 添加监控企业 */
export function addMonitorCompany(companyName: number | string) {
  return request<savePushingRes>({
    url: "/confined/monitor/addMonitorCompany",
    method: "post",
    data: {
      companyName
    }
  })
}
/** 查询企业是否监控 */
export function companyIsMonitoredByLoginUser(companyName: number | string) {
  return request<savePushingRes>({
    url: "/confined/monitor/companyIsMonitoredByLoginUser",
    method: "get",
    params: {
      companyName
    }
  })
}
/** 取消监控企业 */
export function cancelMonitorCompany(companyNames: string[] | number[]) {
  return request<savePushingRes>({
    url: "/confined/monitor/cancelMonitorCompany",
    method: "post",
    data: {
      companyNames
    }
  })
}
